class Solution(object):
    def minimumTotal(self, triangle):
        """
        :type triangle: List[List[int]]
        :rtype: int
        """
        length = len(triangle)
        if length == 1:
            return triangle[0][0]
        for i in range(1, length):
            triangle[i][0] += triangle[i - 1][0]
            for j in range(1, i):
                triangle[i][j] += min(triangle[i - 1][j - 1], triangle[i - 1][j])
            triangle[i][-1] += triangle[i - 1][-1]
        return min(triangle[-1])


data = Solution()
triangle = [[-10]]
print(data.minimumTotal(triangle))